package com.grapro.visitorsystem.utils.json;

import com.grapro.visitorsystem.entity.JsonResult;

public class JsonUtil {
    public static JsonResult build() { return new JsonResult(); }

    // ok
    public static JsonResult ok(String msg) { return new JsonResult(200, msg, null); }

    public static JsonResult ok(String msg, Object obj) {
        return new JsonResult(200, msg, obj);
    }

    public static JsonResult ok(Integer code, String msg, Object obj) {
        return new JsonResult(code, msg, obj);
    }

    // error
    public static JsonResult error(String msg) {
        return new JsonResult(500, msg, null);
    }

    public static JsonResult error(String msg, Object obj) {
        return new JsonResult(500, msg, obj);
    }

    public static JsonResult error(Integer code, String msg) {
        return new JsonResult(500, msg);
    }

}
